/*
 * statement.c
 *
 *  Created on: 2013-5-15
 *      Author: xkaying
 */

#include "statement.h"

#include <assert.h>
#include <stdlib.h>

struct _statement{
		int type;//系统语句类型
		char *function; //字定义语句类型
		char  *opt1;
		char *opt2;
		char *rest;
};

Statement *StatementInit(int type)
{
	Statement *pstatement;
	pstatement=(Statement*)malloc(sizeof(Statement));
	pstatement->type=type;
	pstatement->function=0;
	pstatement->opt1=0;
	pstatement->opt2=0;
	pstatement->rest=0;
	return pstatement;
}

void StatementAppendFunction(Statement *pstatement,char *name)
{
	assert(pstatement);
	assert(name);
	pstatement->function=name;
}

void StatementAppendParam(Statement *pstatement,char *param)
{
	assert(pstatement);
	assert(param);
	pstatement->opt1=param;
}

void StatementAppendParamEx(Statement *pstatement,char *param)
{
	assert(pstatement);
	assert(param);
	pstatement->opt2=param;
}

void StatementAppendResult(Statement *pstatement,char *name)
{
	assert(pstatement);
	assert(name);
	pstatement->rest=name;
}
